<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<html>
<head>
    <title>订单统计</title>
    <script src="../../js/jquery-3.3.1.min.js" charset="utf-8"></script>
    <script src="../../js/cookie/jquery.cookie.js" charset="utf-8"></script>
    <script src="../../layui-v2.2.5/layui/layui.js" charset="utf-8"></script>
    <link rel="stylesheet" href="../../layui-v2.2.5/layui/css/layui.css" media="all">
</head>
<body>

<input placeholder="请输入会员名称或电话号码" id="key" value="${key}"
           style="height: 32px;margin-top: 0.5%; margin-left: 25%;font-size: 24px">
<i class="layui-icon" style="font-size: 30px;" onclick="search()">&#xe615;</i>
<script>
    function search() {
        console.log("搜索事件");
        window.location.href="/marketing/statistcsOrder?activityId=${activityId}&key="+$("#key").val();
    }
</script>

<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right;margin-right: 100px"  href="javascript:location.replace(location.href);"
   title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
<br><br>
<table class="layui-hide" id="test"></table>
<%--<button data-method="confirmTrans" class="layui-btn">配置一个透明的询问框</button>--%>
<script>
    layui.use('table', function(){
        var table = layui.table
            ,form = layui.form;
        table.render({
            elem: '#test'
            ,url:'/marketing/statistcsOrderData?activityId=${activityId}'+"&key="+$("#key").val()
            ,cellMinWidth: 80
            ,cols: [[
                {type:'numbers'}
                ,{field:'id', title:'ID', width:280, }
                ,{field:'name', title:'会员名',width:200,}
                ,{field:'tel', title:'会员电话',width:200,}
                ,{field:'createTime', title: '创建时间', width:200,}
                ,{field:'state', title:'订单状态',width:200,}
                <c:if test="${sessionScope.userType==0}">
                ,{fixed: 'right',title:'订单操作', width:220, align:'center', toolbar: '#barDemo'}
                </c:if>
            ]]
            ,page:true
        });
    });
</script>
<c:if test="${sessionScope.userType==0}">
    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-xs" lay-event="refund">退款</a>
    </script>

    <script>
        layui.use('table', function() {
            var table = layui.table;
            //监听表格复选框选择
            table.on('checkbox(demo)', function (obj) {
                console.log(obj);
            });
            //监听工具条
            table.on('tool(demo)', function (obj) {
                var data = obj.data;
                if (obj.event === 'refund') {//结算金额
                    layer.confirm('确定退款？', function(index){
                        //do something
                         // /marketing/refund?activityId=' + data.id
                        layer.close(index);
                    });

                }
            })
        });
    </script>


</c:if>





</body>
</html>
